﻿using System;
using Moq;
using NUnit.Framework;
using Rhino.Security.Interfaces;
using WineCellar.Business.Entities;
using WineCellar.Business.Services;
using WineCellar.Web.Controllers;
using WineCellar.Web.Tests.TestHelpers;

namespace WineCellar.Web.Tests
{
    [TestFixture]
    public class WineControllerTests
    {
        WineController<Wine> wineController;
        WineService wineService;
        private UserService userService;
        private RegionService regionService;
        private IAuthorizationRepository authRepos;
        ControllerTestContext testContext;        


        [SetUp]
        public void SetUp()
        {
            authRepos = new Mock<IAuthorizationRepository>().Object;
            wineService = new Mock<WineService>(userService,authRepos).Object;
            userService = new Mock<UserService>().Object;
            regionService = new Mock<RegionService>().Object;
            wineController = new WineController<Wine>(wineService,userService,regionService);
            testContext = new ControllerTestContext(wineController);
        }

        [Test]
        public void Edit_Should_Render_View_WineEdit()
        {
            wineController.New()
                .ReturnsViewResult()
                .ForView("WineEdit");         
        }

        [Test]
        public void List_Should_Render_View_Empty()
        {
            wineController.List()
                .ReturnsViewResult()
                .ForView(String.Empty);
        }        
    }
}
